www.gusucode.com > VC++ 宾馆管理系统(MSSQL) > VC++ 宾馆管理系统(MSSQL)/gusucode/Code/ChangePwdDLG.cpp

    //Download by http://www.NewXing.com
// ChangePwdDLG.cpp : implementation file

#include "stdafx.h"
#include "hotel_mis.h"
#include "ChangePwdDLG.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChangePwdDLG dialog


CChangePwdDLG::CChangePwdDLG(CWnd* pParent /*=NULL*/)
	: CDialog(CChangePwdDLG::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChangePwdDLG)
	m_sPWD1 = _T("");
	m_sPWD2 = _T("");
	//}}AFX_DATA_INIT
}


void CChangePwdDLG::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChangePwdDLG)
	DDX_Text(pDX, IDD_CHANGEPWD_PWD1, m_sPWD1);
	DDX_Text(pDX, IDD_CHANGEPWD_PWD2, m_sPWD2);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChangePwdDLG, CDialog)
	//{{AFX_MSG_MAP(CChangePwdDLG)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChangePwdDLG message handlers

BOOL CChangePwdDLG::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	((CEdit*)GetDlgItem(IDD_CHANGEPWD_PWD1))->SetLimitText(10);
	((CEdit*)GetDlgItem(IDD_CHANGEPWD_PWD2))->SetLimitText(10);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CChangePwdDLG::OnOK() 
{
	// TODO: Add extra validation here
	// Make sure pwd1 is not null
    UpdateData(true);
	
	if ( ""==m_sPWD1 )
	{
		AfxMessageBox(_T("密码不能未空"), MB_ICONEXCLAMATION);
        return;
	}
	
	// Judge whether pwd1==pwd2
    if ( 0!=m_sPWD1.Compare(m_sPWD2) )
	{
		AfxMessageBox(_T("两次输入密码不一样,请确认"), MB_ICONEXCLAMATION);
        return;
	}
	
	CDialog::OnOK();
}